<?php

class IndexController extends Controller{

    private $M_users;
    private $M_cates;
    private $M_roles;

    /**
     * 构造方法
     * 初始化
     */
    public function __construct(){
        $this->M_users = Model::getInstance('users');
        $this->M_cates = Model::getInstance('cates');
        $this->M_roles = Model::getInstance('roles');
    }

    public function index(){
        global $user_info;

        $user_info = $user_info;

        $menu_arr = $this->M_cates->getTree();

        $user_roles = $this->M_users->getUserRoles($user_info['user_id']);

        $user_cate_ids = $this->M_users->getUserCateIds($user_info['user_id']);

        $data = array(
            'user_info'=>$user_info,
            'user_roles'=>$user_roles,
            'menu_arr'=>$menu_arr,
            'user_cate_ids'=>$user_cate_ids,
        );

        Template::show('index/index.php',$data);
    }

    public function myHome(){
        Template::show('index/my_home.php');
    }

    public function programMaxim(){
        Template::show('index/program_maxim.php');
    }
}